package com.niiwoo.activity.event.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description: 标的子状态枚举
 * @Author:bincun  通过设置子状态，自动关联出父状态 ，不得单独设置父状态
 * @Date:2017/11/10
 */
@Getter
@AllArgsConstructor
public enum ProjectSubStatusEventEnum {
    //1审核中
    CHECKING_INIT(100,"审核中-初始", ProjectStatusEventEnum.CHECKING,"您的借款正常审核中，请您耐心等候"),
    CHECKING_BACK(101,"审核中-借款审核退回", ProjectStatusEventEnum.CHECKING,"你的借款资料不完善，请完善后再次提交"),
    CHECKING_LOAN_FAKE_PASS(102,"借款反欺诈-通过", ProjectStatusEventEnum.CHECKING,"您的借款正常审核中，请您耐心等候"),
    CHECKING_AUTO_SUCCESS(103,"自动审核-通过", ProjectStatusEventEnum.CHECKING,"您的借款正常审核中，请您耐心等候"),
    CHECKING_AUTO_MANUAL(104,"自动审核-人工审核", ProjectStatusEventEnum.CHECKING,"您的借款正常审核中，请您耐心等候"),
    CHECKING_MANUAL_SUCCESS(105,"人工审核-通过", ProjectStatusEventEnum.CHECKING,"您的借款正常审核中，请您耐心等候"),
    CHECKING_FOR_CONFIRM(106,"审核通过-待确认", ProjectStatusEventEnum.CHECKING,"您的借款申请已审核通过，个别信息项已修改，请重新签约"),
    CHECKING_BACK_PHONEOPERATOR_TIMEOUT(107,"借款退回-运营商数据获取超时", ProjectStatusEventEnum.CHECKING,"你的借款资料不完善，请完善后再次提交"),
    CHECKING_BACK_ADDRESSLIST_TIMEOUT(108,"借款退回-通讯录回流超时", ProjectStatusEventEnum.CHECKING,"你的借款资料不完善，请完善后再次提交"),

    //2筹款中
    COLLECTING_INIT(200,"筹款中-投资中", ProjectStatusEventEnum.COLLECTING,""),
    COLLECTING_LENDING(201,"筹款中-放款中", ProjectStatusEventEnum.COLLECTING,""),

    //3还款中
    REPAYING_INIT(300,"还款中-正常还款中", ProjectStatusEventEnum.REPAYING,"还款日20:00前，请确保你我金融账户或已开通代扣银行卡余额充足（银行卡尾号{0}）"),
    REPAYING_OVERDUE(301,"还款中-逾期还款中", ProjectStatusEventEnum.REPAYING,"您的还款已逾期{0}天，请尽快还款，避免影响个人信用及产生额外费用"),
    REPAYING_BAD(302,"还款中-坏账还款中", ProjectStatusEventEnum.REPAYING,"您的还款已逾期{0}天，项目已停止，请尽快还款，避免影响个人信用及产生额外费用"),

    //4已结清
    FINISH_NORMAL(400,"已结清-正常结清", ProjectStatusEventEnum.FINISH,"还款已结清，让你的信用更有价值，请继续保持良好信用"),
    FINISH_ADVANCE(401,"已结清-提前结清", ProjectStatusEventEnum.FINISH,"还款已结清，让你的信用更有价值，请继续保持良好信用"),
    FINISH_BAD(402,"已结清-坏账结清", ProjectStatusEventEnum.FINISH,"逾期还款已结清"),
    FINISH_OVERDUE(403,"已结清-逾期结清", ProjectStatusEventEnum.FINISH,"逾期还款已结清"),

    //5已流标
    MISCARRY_AUTO_FAILED(500,"流标-自动审核不通过", ProjectStatusEventEnum.MISCARRY,"借款资质不符合平台要求"),
    MISCARRY_MANUAL_FAILED(501,"流标-人工审核不通过", ProjectStatusEventEnum.MISCARRY,""),
    MISCARRY_BACK_OVERTIME(502,"流标-借款退回超时未处理", ProjectStatusEventEnum.MISCARRY,"你的借款资料不完善，请完善后再次提交"),
    MISCARRY_CANCER_BORROWER(503,"流标-借款人手动取消", ProjectStatusEventEnum.MISCARRY,""),
    MISCARRY_INVEST_OVERTIME(504,"流标-投资超时", ProjectStatusEventEnum.MISCARRY,""),
    MISCARRY_CANCER_MANAGER(505,"流标-管理人员手动取消", ProjectStatusEventEnum.MISCARRY,""),
    MISCARRY_LOAN_FAKE_FAILED(506,"流标-借款反欺诈不通过", ProjectStatusEventEnum.MISCARRY,"借款资质不符合平台要求"),
    MISCARRY_LOAN_BATCH(507,"管理员批量流标", ProjectStatusEventEnum.MISCARRY,""),
    MISCARRY_PUSH_FAIL(508,"存管上标失败", ProjectStatusEventEnum.MISCARRY,""),
    MISCARRY_R360_TIMEOUT_UNCONFIRMED(509,"流标-融360超时未确认", ProjectStatusEventEnum.MISCARRY,""),
    ;

    private int subStatus;
    private String desc;
    private ProjectStatusEventEnum parentStatusEnum;
    private String msg;


    public static ProjectSubStatusEventEnum enumOf(int subStatus) {
        for (ProjectSubStatusEventEnum retEnum : values()) {
            if (retEnum.subStatus == subStatus) {
                return retEnum;
            }
        }
        return null;
    }
}
